*Replication file for article in JPP
*Lena Maria Schaffer 12.5.2021

*Data sets included are to replicate tables and figures within the following article:
*Lena Maria Schaffer, Bianca Oehl und Thomas Bernauer (2021) “Are Policy-makers Responsive to Public Demand in Climate Politics?”
*Journal of Public Policy.

***********************************************************************************************
*** STEP 1 - Analysis for all targets aggregated
***********************************************************************************************
*** PANEL
***********************************************************************************************
clear

use JPP_country_panel.dta
*tsset cowcode year
xtset cowcode year
**GRAFIKEN
label define countries 2 "USA" 20 "Canada" 225 "Switzerland" 230 "Spain" 255 "Germany" 325 "Italy"  
label values cowcode countries

** Figure 2a GRaph Salience
sort year cowcode
xtline stock_diff, lcolor(gs7) lwidth(medthick) lpattern(solid) addplot((line salience_relative year, yaxis(2) lcolor(black) ///
lwidth(medthick) lpattern(dash))) scheme(s2mono) name(descrip_figure2a, replace) graphregion(margin(vsmall))
graph export descrip_figure2a.png, replace
*** Figure 2b Graph Opinion 
xtline stock_diff, lcolor(gs7) lwidth(medthick) lpattern(solid) addplot((line opinion year, yaxis(2) lcolor(black) ///
lwidth(medthick) lpattern(dash))) scheme(s2mono) name(descrip_figure2b, replace) graphregion(margin(vsmall))
graph export descrip_figure2b.png, replace

***  Table 3 Basic Models
eststo clear
xtset cowcode year
eststo M1: xtreg stock_diff l.stock l.opinion d.opinion, vce(cluster country) 
eststo M2: xtreg stock_diff l.stock l.salience_relative d.salience_relative  , vce(cluster country)
eststo M3: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative, vce(cluster country) 
eststo M4: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative c.l.opinion#c.l.salience_relative c.d.opinion#c.d.salience_relative , vce(cluster country) 

esttab M1 M2 M3 M4 using Tab3.rtf, replace  label t(2) b(2) scalars(r2_w  r2_b  r2_o rmse) ///
onecell star(* 0.10 ** 0.05 *** 0.01) lines depv title(Basic Models)

***  Table 4 Basic Models: with controls
gen gdp_pc=gdp_pp_abs/1000
eststo clear
eststo M5: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative  c.l.opinion#c.l.salience_relative c.d.opinion#c.d.salience_relative gov_left1  , vce(cluster country) 
eststo M6: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative c.l.opinion#c.l.salience_relative c.d.opinion#c.d.salience_relative prop_repr , vce(cluster country) 
eststo M7: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative  c.l.opinion#c.l.salience_relative c.d.opinion#c.d.salience_relative prop_repr gov_left1, vce(cluster country) 
eststo M8: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative  c.l.opinion#c.l.salience_relative c.d.opinion#c.d.salience_relative prop_repr gov_left1 gdp_gr_pa, vce(cluster country) 
eststo M9: xtreg stock_diff l.stock l.opinion d.opinion l.salience_relative d.salience_relative c.l.opinion#c.l.salience_relative c.d.opinion#c.d.salience_relative prop_repr gov_left1 co2_em_pc, vce(cluster country) 

esttab M5 M6 M7 M8 M9 using Tab4.rtf, ///
 label replace  t(2) b(2) scalars(r2_w  r2_b  r2_o rmse) star(* 0.10 ** 0.05 *** 0.01)


***************************************************************************************************************************************************************
***************************************************** TARGET - level analysis *******************************************************************
***********************************************************************************************
*** STEP 2 - Analysis for target specific demand, all targets pooled
***********************************************************************************************
*** PANEL
***********************************************************************************************
clear
set more off
use JPP_target_panel.dta 

drop if stock_diff==.
label var stock_diff "{&Delta} Stock"
label var stock "Target Stock"
label var prop_repr "Proportional representation"

xtset cowtarget year

*** Table 5: Basic models for target-specific responsiveness with stepwise inclusion of control variables
eststo clear 
set more off 
eststo M10: xtreg stock_diff l.stock l.Opiniontarget d.Opiniontarget , vce(cluster cowcode) 
eststo M11: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel, vce(cluster cowcode) 
eststo M12: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel  l.Opiniontarget d.Opiniontarget c.l.Opiniontarget#c.l.Articletarget_rel c.d.Opiniontarget#c.d.Articletarget_rel, vce(cluster cowcode)
eststo M13: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel l.Opiniontarget d.Opiniontarget c.l.Opiniontarget#c.l.Articletarget_rel c.d.Opiniontarget#c.d.Articletarget_rel gov_left1, vce(cluster cowcode) 
eststo M14: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel  l.Opiniontarget d.Opiniontarget c.l.Opiniontarget#c.l.Articletarget_rel c.d.Opiniontarget#c.d.Articletarget_rel  prop_repr , vce(cluster cowcode) 
eststo M15: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel l.Opiniontarget d.Opiniontarget c.l.Opiniontarget#c.l.Articletarget_rel c.d.Opiniontarget#c.d.Articletarget_rel  prop_repr gov_left1 gdp_gr_pa , vce(cluster cowcode)
eststo M16: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel  l.Opiniontarget d.Opiniontarget c.l.Opiniontarget#c.l.Articletarget_rel c.d.Opiniontarget#c.d.Articletarget_rel  prop_repr gov_left1 co2_em_pc, vce(cluster cowcode) 

esttab M10 M11 M12 M13 M14 M15 M16 using Tab5.rtf	, ///
 label replace  t(2) b(2) scalars(r2_w  r2_b  r2_o rmse) onecell star(* 0.10 ** 0.05 *** 0.01)
*/
 
***Figure 3 Interaction effects of salience and opinion (Scope for action)
***Figure 3a: Lopinion and Lsalience
eststo: xtreg stock_diff l.stock cl.Articletarget_rel##cl.Opiniontarget d.Articletarget_rel d.Opiniontarget,  vce(cluster cowcode)
margins, dydx(l.Opiniontarget) at( l.Articletarget_rel=(0(0.02)0.85))
marginsplot, yline(0, lcolor(gs15)) level(90) scheme(s1mono)
graph export Figure3a.png, replace
*Figure 3b: Dsalience dopinion
eststo: xtreg stock_diff l.stock l.Articletarget_rel l.Opiniontarget cd.Articletarget_rel##cd.Opiniontarget,  vce(cluster cowcode) 
margins, dydx(d.Opiniontarget) at( d.Articletarget_rel=(-0.4(0.02)0.4))
marginsplot, yline(0, lcolor(gs15)) level(90) scheme(s1mono)
graph export Figure3b.png, replace 
 
**** Figure 4a-d: Interaction effect of electoral system with our four public demand measures
eststo clear
label define prop 0 "Majoritarian Representation" 1 "Proportional Representation"  
label values prop_repr prop
** Interaction with electoral system / Salience
eststo: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel c.l.Opiniontarget c.d.Opiniontarget i.prop_repr i.prop_repr##c.l.Articletarget_rel i.prop_repr##c.d.Articletarget_rel, vce(cluster cowcode) 
margins, at( l.Articletarget_rel=(0(0.03)0.85) prop_repr=(0) prop_repr=(1))
marginsplot,  yline(0, lcolor(gs15)) xtitle("Target Salience, t-1") level(90)scheme(s1mono)
graph export figure4a.png, replace
margins, at( d.Articletarget_rel=(-0.4(0.03)0.4) prop_repr=(0) prop_repr=(1))
marginsplot,  yline(0, lcolor(gs15)) xtitle("∆ Target Salience") level(90) scheme(s1mono)
graph export figure4b.png, replace
******** 
** Interaction with electoral system / Opinion
eststo: xtreg stock_diff l.stock l.Articletarget_rel d.Articletarget_rel c.l.Opiniontarget c.d.Opiniontarget i.prop_repr i.prop_repr##c.l.Opiniontarget i.prop_repr##c.d.Opiniontarget, vce(cluster cowcode) 
margins, at( l.Opiniontarget=(-1(0.05)1) prop_repr=(0) prop_repr=(1))
marginsplot,  yline(0, lcolor(gs15))  xtitle("Target Opinion, t-1") level(90) scheme(s1mono)
graph export figure4c.png, replace
margins, at( d.Opiniontarget=(-2(0.1)2) prop_repr=(0) prop_repr=(1))
marginsplot,  yline(0, lcolor(gs15)) xtitle("∆ Target Opinion") level(90) scheme(s1mono)
graph export figure4d.png, replace

*************************************************************************************************************************************


